from django.db import models
from django.contrib.auth.models import User
# Create your models here.
from utils.modelsMixin import ModelSetMixin
class UserDetail(ModelSetMixin):
    SEX_CHOICES = (
        (0,'女'),
        (1,'男')
    )
    avatar = models.TextField(null=True,blank=True,verbose_name='头像')
    phone = models.CharField(null=True,blank=True,verbose_name='手机号',max_length=11,unique=True)
    age = models.IntegerField(null=True,blank=True,verbose_name='年龄')
    sex = models.IntegerField(null=True,blank=True,verbose_name='性别',choices=SEX_CHOICES)
    birthday = models.DateField(null=True,blank=True,verbose_name='生日')

    user = models.OneToOneField(User,on_delete=models.DO_NOTHING)

    class Meta:
        db_table = 'user_detail'
        verbose_name = '用户详情' #正向查询
        verbose_name_plural = verbose_name #反向查询


